home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
TCL1
/
CDICTION
/
CSMARTTE.C
< prev
next >
Wrap
Text File
|
1990-01-12
|
2KB
|
78 lines
/********************************************************************
CSmartTETask.c
see header for information
SUPERCLASS = CTask
********************************************************************/
#include "CSmartTETask.h"
#include "CSmartEditText.h"
#include "CSmartDocument.h"
/*****************************************************************************/
void CSmartTETask::ISmartTETask( CSmartEditText *theEditText, Int16 firstNameIndex,
tTE_Command theCommand)
{
Handle h;
CTask::ITask( firstNameIndex + (Int16) theCommand);
itsEditText = theEditText;
itsCommand = theCommand;
itsEditText->GetSelection( &startSel, &endSel);
wasDirty = itsEditText->IsDirty();
h = itsEditText->GetTextHandle();
/*FailNIL( h);*/
HandToHand( &h);
/*FailMemError();*/
undoText = h;
} /* CSmartTETask::ISmartTETask */
/*****************************************************************************/
void CSmartTETask::Undo( void)
{
Handle tmp;
Boolean tmpDirty;
Int16 tmpStart, tmpEnd;
/* need to make sure the right edit text is active */
if (!itsEditText->IsActive() && itsEditText->itsSmartDoc)
{
itsEditText->itsSmartDoc->ActivateEditItem( itsEditText);
}
tmp = itsEditText->GetTextHandle();
/*FailNIL( tmp);*/
HandToHand( &tmp);
/*FailMemError();*/
itsEditText->GetSelection( &tmpStart, &tmpEnd);
itsEditText->SetTextHandle( undoText);
DisposHandle( undoText); /* CEditText makes a copy */
itsEditText->SetSelection( startSel, endSel);
undoText = tmp;
tmpDirty = itsEditText->IsDirty();
itsEditText->SetDirty( wasDirty);
wasDirty = tmpDirty;
startSel = tmpStart;
endSel = tmpEnd;
} /* CSmartTETask::Undo */
/*****************************************************************************/
void CSmartTETask::Dispose( void)
{
if (undoText) DisposHandle( undoText);
inherited::Dispose();
} /* CSmartTETask::Dispose */
/*****************************************************************************/